package com.example.activitytest;

import androidx.appcompat.app.AppCompatActivity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.Toast;

public class ThirdActivity extends BaseActivity implements View.OnClickListener{
    private EditText editText;
    private Button clearProgressBarButton1;
    private Button clearProgressBarButton2;
    private ProgressBar progressBar2;
    private ProgressBar progressBar1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_third);
        editText = (EditText) findViewById(R.id.editTextTextPassword);
        Button submitButton = (Button) findViewById(R.id.submit_button);
        submitButton.setOnClickListener(this);

        clearProgressBarButton1 = (Button) findViewById(R.id.button8);
        clearProgressBarButton2 = (Button) findViewById(R.id.button9);
        progressBar1 = (ProgressBar) findViewById(R.id.progress_bar1);
        progressBar2 = (ProgressBar) findViewById(R.id.progress_bar2);

        clearProgressBarButton1.setOnClickListener(this);
        clearProgressBarButton2.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        if(view.getId() == R.id.submit_button){
            String inputText = editText.getText().toString();
            Intent intent = new Intent(ThirdActivity.this,NormalActivity.class);
            intent.putExtra("pass_word",inputText);
            startActivity(intent);
        }
        else if (view.getId() == R.id.button8){
            progressBar1.setVisibility(View.GONE);
        }
        else if (view.getId() == R.id.button9){
            int progress = progressBar2.getProgress();
            progress = progress + 10;
            progressBar2.setProgress(progress);
        }
    }
}